package flc.ast.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.AlbumBean;
import flc.ast.bean.RecordBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class AlbumAdapter extends StkProviderMultiAdapter<AlbumBean> {

    public AlbumAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(82));
        addItemProvider(new AlbumProvider());
    }

    private class AlbumProvider extends BaseItemProvider<AlbumBean> {

        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_album;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, AlbumBean bean) {
            if (bean.getVideoNum()==0){
                baseViewHolder.setImageResource(R.id.ivAlbumItemImg,R.drawable.icon_kxc);
            }else {
                Glide.with(getContext()).load(bean.getFirstPath())
                        .into((ImageView) baseViewHolder.getView(R.id.ivAlbumItemImg));
            }
            baseViewHolder.setText(R.id.tvAlbumItemName,bean.getAlbumName());
            baseViewHolder.setText(R.id.tvAlbumItemSize, bean.getVideoNum()+"个视频");
        }

    }

}
